<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>my_binary_tree: my_binary_tree&lt; T &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">my_binary_tree<span id="projectnumber">&#160;0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search',true);
  $(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(function(){initNavTree('classmy__binary__tree.html','','classmy__binary__tree-members'); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="headertitle"><div class="title">my_binary_tree&lt; T &gt; Class Template Reference</div></div>
</div><!--header-->
<div class="contents">

<p>二叉树类（模板类，支持任意数据类型T）  
 <a href="#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="my__binary__tree_8h_source.html">my_binary_tree.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for my_binary_tree&lt; T &gt;:</div>
<div class="dyncontent">
<div class="center"><img src="classmy__binary__tree__inherit__graph.png" border="0" usemap="#amy__binary__tree_3_01_t_01_4_inherit__map" loading="lazy" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-pub-methods" class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae19ca02504d47a17836f0b0c533f8982" id="r_ae19ca02504d47a17836f0b0c533f8982"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae19ca02504d47a17836f0b0c533f8982">my_binary_tree</a> (T val)</td></tr>
<tr class="memdesc:ae19ca02504d47a17836f0b0c533f8982"><td class="mdescLeft">&#160;</td><td class="mdescRight">构造函数（创建单个节点）  <br /></td></tr>
<tr class="memitem:a6faf690077dab82f4d1f72920c3834fd" id="r_a6faf690077dab82f4d1f72920c3834fd"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a6faf690077dab82f4d1f72920c3834fd">my_binary_tree</a> (const <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; &amp;other)</td></tr>
<tr class="memdesc:a6faf690077dab82f4d1f72920c3834fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">拷贝构造函数（深拷贝）  <br /></td></tr>
<tr class="memitem:aabd378c4f70ed8c8e76691769d111c59" id="r_aabd378c4f70ed8c8e76691769d111c59"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aabd378c4f70ed8c8e76691769d111c59">~my_binary_tree</a> ()</td></tr>
<tr class="memdesc:aabd378c4f70ed8c8e76691769d111c59"><td class="mdescLeft">&#160;</td><td class="mdescRight">析构函数（递归释放内存）  <br /></td></tr>
<tr class="memitem:a488bf2adcd7de91b9e259f6ef8c7762b" id="r_a488bf2adcd7de91b9e259f6ef8c7762b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a488bf2adcd7de91b9e259f6ef8c7762b">construct_binary_tree</a> (vector&lt; T &gt; values, int index, T space)</td></tr>
<tr class="memdesc:a488bf2adcd7de91b9e259f6ef8c7762b"><td class="mdescLeft">&#160;</td><td class="mdescRight">层先法构造普通二叉树（支持空节点）  <br /></td></tr>
<tr class="memitem:a6f45e4cb6774b092b40bee77ee80b757" id="r_a6f45e4cb6774b092b40bee77ee80b757"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a6f45e4cb6774b092b40bee77ee80b757">mirror</a> ()</td></tr>
<tr class="memdesc:a6f45e4cb6774b092b40bee77ee80b757"><td class="mdescLeft">&#160;</td><td class="mdescRight">二叉树镜像（交换所有节点的左右子树）  <br /></td></tr>
<tr class="memitem:a8fc393aceaa7e46fc5fb6b9377c12ea3" id="r_a8fc393aceaa7e46fc5fb6b9377c12ea3"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8fc393aceaa7e46fc5fb6b9377c12ea3">is_empty</a> ()</td></tr>
<tr class="memdesc:a8fc393aceaa7e46fc5fb6b9377c12ea3"><td class="mdescLeft">&#160;</td><td class="mdescRight">判断二叉树是否为空  <br /></td></tr>
<tr class="memitem:a05b6069959ff87dc7824ce4e05db024a" id="r_a05b6069959ff87dc7824ce4e05db024a"><td class="memItemLeft" align="right" valign="top">T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a05b6069959ff87dc7824ce4e05db024a">get_value</a> ()</td></tr>
<tr class="memdesc:a05b6069959ff87dc7824ce4e05db024a"><td class="mdescLeft">&#160;</td><td class="mdescRight">打印当前节点的数据值  <br /></td></tr>
<tr class="memitem:ace03005196f04451f9af5c2ab663a990" id="r_ace03005196f04451f9af5c2ab663a990"><td class="memItemLeft" align="right" valign="top">T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ace03005196f04451f9af5c2ab663a990">get_value</a> (string position)</td></tr>
<tr class="memdesc:ace03005196f04451f9af5c2ab663a990"><td class="mdescLeft">&#160;</td><td class="mdescRight">打印当前节点的数据值  <br /></td></tr>
<tr class="memitem:a047c1a5b1fb76a0cb62700eb1c53bb8b" id="r_a047c1a5b1fb76a0cb62700eb1c53bb8b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a047c1a5b1fb76a0cb62700eb1c53bb8b">get_height</a> ()</td></tr>
<tr class="memdesc:a047c1a5b1fb76a0cb62700eb1c53bb8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">计算二叉树的高度  <br /></td></tr>
<tr class="memitem:ad8ae3e1b3073a79df62de135e337192a" id="r_ad8ae3e1b3073a79df62de135e337192a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad8ae3e1b3073a79df62de135e337192a">get_h_layer_nodes</a> (int h)</td></tr>
<tr class="memdesc:ad8ae3e1b3073a79df62de135e337192a"><td class="mdescLeft">&#160;</td><td class="mdescRight">计算第h层的节点总数  <br /></td></tr>
<tr class="memitem:a76f83530b098d7ad84262d21c885c15d" id="r_a76f83530b098d7ad84262d21c885c15d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a76f83530b098d7ad84262d21c885c15d">get_last_layer_nodes</a> ()</td></tr>
<tr class="memdesc:a76f83530b098d7ad84262d21c885c15d"><td class="mdescLeft">&#160;</td><td class="mdescRight">计算最后一层（叶子节点层）的节点总数  <br /></td></tr>
<tr class="memitem:aabf0c965e92e633f4d25f9b88da19a28" id="r_aabf0c965e92e633f4d25f9b88da19a28"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aabf0c965e92e633f4d25f9b88da19a28">get_nodes_num</a> ()</td></tr>
<tr class="memdesc:aabf0c965e92e633f4d25f9b88da19a28"><td class="mdescLeft">&#160;</td><td class="mdescRight">计算二叉树的总节点数  <br /></td></tr>
<tr class="memitem:a9279b204f13b6f6e79646fe38387607a" id="r_a9279b204f13b6f6e79646fe38387607a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9279b204f13b6f6e79646fe38387607a">get_lrest_leave</a> (string l_or_r)</td></tr>
<tr class="memdesc:a9279b204f13b6f6e79646fe38387607a"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取最左或最右的叶子节点  <br /></td></tr>
<tr class="memitem:adb685df412bb6481f5167165312868ad" id="r_adb685df412bb6481f5167165312868ad"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#adb685df412bb6481f5167165312868ad">is_binary_search_tree</a> ()</td></tr>
<tr class="memdesc:adb685df412bb6481f5167165312868ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">判断二叉树是否为二叉搜索树（BST）  <br /></td></tr>
<tr class="memitem:a490bf7f8ebe87b6040b1294f73979fea" id="r_a490bf7f8ebe87b6040b1294f73979fea"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a490bf7f8ebe87b6040b1294f73979fea">find</a> (int val)</td></tr>
<tr class="memdesc:a490bf7f8ebe87b6040b1294f73979fea"><td class="mdescLeft">&#160;</td><td class="mdescRight">查找值为val的节点  <br /></td></tr>
<tr class="memitem:ad767eada19d83ada460c5eb0c2104056" id="r_ad767eada19d83ada460c5eb0c2104056"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad767eada19d83ada460c5eb0c2104056">find_father</a> (<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *son)</td></tr>
<tr class="memdesc:ad767eada19d83ada460c5eb0c2104056"><td class="mdescLeft">&#160;</td><td class="mdescRight">查找指定节点的父节点  <br /></td></tr>
<tr class="memitem:a35c9081b6b3dfe457c8d29697ccfdfb1" id="r_a35c9081b6b3dfe457c8d29697ccfdfb1"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a35c9081b6b3dfe457c8d29697ccfdfb1">is_balence_binary_tree</a> ()</td></tr>
<tr class="memdesc:a35c9081b6b3dfe457c8d29697ccfdfb1"><td class="mdescLeft">&#160;</td><td class="mdescRight">判断二叉树是否为平衡二叉树（左右子树高度差不超过1）  <br /></td></tr>
<tr class="memitem:aa23b0dbc0a4f4f7741111867f6d8b2e9" id="r_aa23b0dbc0a4f4f7741111867f6d8b2e9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa23b0dbc0a4f4f7741111867f6d8b2e9">append</a> (<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *another_tree, string l_or_r)</td></tr>
<tr class="memdesc:aa23b0dbc0a4f4f7741111867f6d8b2e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">向当前节点追加左/右子树  <br /></td></tr>
<tr class="memitem:a19f020b91ef749755745ac08d69be0b6" id="r_a19f020b91ef749755745ac08d69be0b6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a19f020b91ef749755745ac08d69be0b6">copy</a> (<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *des, <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *src)</td></tr>
<tr class="memdesc:a19f020b91ef749755745ac08d69be0b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">复制二叉树（从src拷贝到des）  <br /></td></tr>
<tr class="memitem:a9675071237ce43751138c4fa3ef43657" id="r_a9675071237ce43751138c4fa3ef43657"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9675071237ce43751138c4fa3ef43657">insert</a> (T val, string position)</td></tr>
<tr class="memdesc:a9675071237ce43751138c4fa3ef43657"><td class="mdescLeft">&#160;</td><td class="mdescRight">插入节点（未实现）  <br /></td></tr>
<tr class="memitem:a24a14198a85ebfd603f5284ef9940e41" id="r_a24a14198a85ebfd603f5284ef9940e41"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a24a14198a85ebfd603f5284ef9940e41">delete_point</a> (<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *point)</td></tr>
<tr class="memdesc:a24a14198a85ebfd603f5284ef9940e41"><td class="mdescLeft">&#160;</td><td class="mdescRight">删除节点（未实现）  <br /></td></tr>
<tr class="memitem:a5fe4fbbeb0729ef67cc258d2a5350860" id="r_a5fe4fbbeb0729ef67cc258d2a5350860"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5fe4fbbeb0729ef67cc258d2a5350860">delete_pos</a> (string position)</td></tr>
<tr class="memdesc:a5fe4fbbeb0729ef67cc258d2a5350860"><td class="mdescLeft">&#160;</td><td class="mdescRight">删除节点（未实现）  <br /></td></tr>
<tr class="memitem:a5842011f1564adb291d8a62f1f7e7625" id="r_a5842011f1564adb291d8a62f1f7e7625"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5842011f1564adb291d8a62f1f7e7625">revolve</a> (string mode)</td></tr>
<tr class="memdesc:a5842011f1564adb291d8a62f1f7e7625"><td class="mdescLeft">&#160;</td><td class="mdescRight">旋转二叉树（未实现）  <br /></td></tr>
<tr class="memitem:abf00c3450fd579d439c231202d2af556" id="r_abf00c3450fd579d439c231202d2af556"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#abf00c3450fd579d439c231202d2af556">revolve</a> (<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *node, string mode)</td></tr>
<tr class="memdesc:abf00c3450fd579d439c231202d2af556"><td class="mdescLeft">&#160;</td><td class="mdescRight">旋转二叉树（未实现）  <br /></td></tr>
<tr class="memitem:a3b473ee42358d2ecda1958b1b72fd1dd" id="r_a3b473ee42358d2ecda1958b1b72fd1dd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3b473ee42358d2ecda1958b1b72fd1dd">show_binary_tree</a> (string mode)</td></tr>
<tr class="memdesc:a3b473ee42358d2ecda1958b1b72fd1dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">遍历二叉树并打印节点值  <br /></td></tr>
<tr class="memitem:a4a4f092d8f75d1f8840db3c3b4b6f36e" id="r_a4a4f092d8f75d1f8840db3c3b4b6f36e"><td class="memTemplParams" colspan="2">template&lt;typename Function&gt; </td></tr>
<tr class="memitem:a4a4f092d8f75d1f8840db3c3b4b6f36e template"><td class="memItemLeft" align="right" valign="top">Function&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4a4f092d8f75d1f8840db3c3b4b6f36e">traversal_binary_tree</a> (string mode, Function F)</td></tr>
<tr class="memdesc:a4a4f092d8f75d1f8840db3c3b4b6f36e"><td class="mdescLeft">&#160;</td><td class="mdescRight">遍历二叉树并执行自定义函数（无空节点处理）  <br /></td></tr>
<tr class="memitem:ad3840bd8912df340bc10aa59bc89d1bd" id="r_ad3840bd8912df340bc10aa59bc89d1bd"><td class="memTemplParams" colspan="2">template&lt;typename Function1, typename Function2&gt; </td></tr>
<tr class="memitem:ad3840bd8912df340bc10aa59bc89d1bd template"><td class="memItemLeft" align="right" valign="top">Function1&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad3840bd8912df340bc10aa59bc89d1bd">traversal_binary_tree</a> (string mode, Function1 F1, Function2 F2)</td></tr>
<tr class="memdesc:ad3840bd8912df340bc10aa59bc89d1bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">遍历二叉树并执行自定义函数（含空节点处理）  <br /></td></tr>
<tr class="memitem:aff9c3c138c4fc970016a826ec0653eaf" id="r_aff9c3c138c4fc970016a826ec0653eaf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aff9c3c138c4fc970016a826ec0653eaf">print_full_to_vector</a> (vector&lt; T &gt; &amp;vv)</td></tr>
<tr class="memdesc:aff9c3c138c4fc970016a826ec0653eaf"><td class="mdescLeft">&#160;</td><td class="mdescRight">层序遍历二叉树，将节点值存入向量（不含占位符）  <br /></td></tr>
<tr class="memitem:aa65e9e0bae93b835e20c32de429928d3" id="r_aa65e9e0bae93b835e20c32de429928d3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa65e9e0bae93b835e20c32de429928d3">print_to_vector</a> (vector&lt; T &gt; &amp;vv)</td></tr>
<tr class="memdesc:aa65e9e0bae93b835e20c32de429928d3"><td class="mdescLeft">&#160;</td><td class="mdescRight">层序遍历二叉树，将节点值存入向量（空节点用占位符）  <br /></td></tr>
<tr class="memitem:aedeb2af1e014d361fb7c2f1423e9f58d" id="r_aedeb2af1e014d361fb7c2f1423e9f58d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aedeb2af1e014d361fb7c2f1423e9f58d">operator=</a> (<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; &amp;other)</td></tr>
<tr class="memdesc:aedeb2af1e014d361fb7c2f1423e9f58d"><td class="mdescLeft">&#160;</td><td class="mdescRight">赋值运算符重载（深拷贝）  <br /></td></tr>
<tr class="memitem:a52db051eb0ccae70e61baf638acd2f81" id="r_a52db051eb0ccae70e61baf638acd2f81"><td class="memItemLeft" align="right" valign="top">T&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a52db051eb0ccae70e61baf638acd2f81">operator[]</a> (int index)</td></tr>
<tr class="memdesc:a52db051eb0ccae70e61baf638acd2f81"><td class="mdescLeft">&#160;</td><td class="mdescRight">索引运算符重载  <br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-pro-attribs" class="groupheader"><a id="pro-attribs" name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:ae2d15edcaec6e5543a5e8c64ea0173cb" id="r_ae2d15edcaec6e5543a5e8c64ea0173cb"><td class="memItemLeft" align="right" valign="top"><a id="ae2d15edcaec6e5543a5e8c64ea0173cb" name="ae2d15edcaec6e5543a5e8c64ea0173cb"></a>
T&#160;</td><td class="memItemRight" valign="bottom"><b>data</b></td></tr>
<tr class="memdesc:ae2d15edcaec6e5543a5e8c64ea0173cb"><td class="mdescLeft">&#160;</td><td class="mdescRight">节点存储的数据 <br /></td></tr>
<tr class="memitem:a69a6f187348e8b6219809620e784d3cf" id="r_a69a6f187348e8b6219809620e784d3cf"><td class="memItemLeft" align="right" valign="top"><a id="a69a6f187348e8b6219809620e784d3cf" name="a69a6f187348e8b6219809620e784d3cf"></a>
<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *&#160;</td><td class="memItemRight" valign="bottom"><b>left</b></td></tr>
<tr class="memdesc:a69a6f187348e8b6219809620e784d3cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">左子树指针 <br /></td></tr>
<tr class="memitem:a8910dc810a9a95fe4dc308eeef739b6a" id="r_a8910dc810a9a95fe4dc308eeef739b6a"><td class="memItemLeft" align="right" valign="top"><a id="a8910dc810a9a95fe4dc308eeef739b6a" name="a8910dc810a9a95fe4dc308eeef739b6a"></a>
<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *&#160;</td><td class="memItemRight" valign="bottom"><b>right</b></td></tr>
<tr class="memdesc:a8910dc810a9a95fe4dc308eeef739b6a"><td class="mdescLeft">&#160;</td><td class="mdescRight">右子树指针 <br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-friends" class="groupheader"><a id="friends" name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a9b5581a82079878a7faac62d07bbcc12" id="r_a9b5581a82079878a7faac62d07bbcc12"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9b5581a82079878a7faac62d07bbcc12">operator==</a> (<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; lhs, <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; rhs)</td></tr>
<tr class="memdesc:a9b5581a82079878a7faac62d07bbcc12"><td class="mdescLeft">&#160;</td><td class="mdescRight">相等运算符重载（判断两棵树是否完全相同）  <br /></td></tr>
<tr class="memitem:a57bcf0e8e11dcb2db4d3c2b72e62d913" id="r_a57bcf0e8e11dcb2db4d3c2b72e62d913"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a57bcf0e8e11dcb2db4d3c2b72e62d913">operator!=</a> (<a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; lhs, <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; rhs)</td></tr>
<tr class="memdesc:a57bcf0e8e11dcb2db4d3c2b72e62d913"><td class="mdescLeft">&#160;</td><td class="mdescRight">不等运算符重载  <br /></td></tr>
<tr class="memitem:a9b9d88b02caf22fc6de3a78e3a514816" id="r_a9b9d88b02caf22fc6de3a78e3a514816"><td class="memItemLeft" align="right" valign="top">ostream &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9b9d88b02caf22fc6de3a78e3a514816">operator&lt;&lt;</a> (ostream &amp;os, <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; p)</td></tr>
<tr class="memdesc:a9b9d88b02caf22fc6de3a78e3a514816"><td class="mdescLeft">&#160;</td><td class="mdescRight">输出运算符重载（格式化打印二叉树）  <br /></td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><div class="compoundTemplParams">template&lt;typename T&gt;<br />
class my_binary_tree&lt; T &gt;</div><p>二叉树类（模板类，支持任意数据类型T） </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td>二叉树节点存储的数据类型 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>支持二叉树的构建、遍历、查询、修改等操作，包含常见的二叉树算法实现 </dd></dl>
</div><a name="doc-constructors" id="doc-constructors"></a><h2 id="header-doc-constructors" class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ae19ca02504d47a17836f0b0c533f8982" name="ae19ca02504d47a17836f0b0c533f8982"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae19ca02504d47a17836f0b0c533f8982">&#9670;&#160;</a></span>my_binary_tree() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;<a class="el" href="classmy__binary__tree.html">::my_binary_tree</a> </td>
          <td>(</td>
          <td class="paramtype">T</td>          <td class="paramname"><span class="paramname"><em>val</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>构造函数（创建单个节点） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">val</td><td>节点存储的数据值 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>初始时左、右子树均为NULL；示例：my_binary_tree&lt;int&gt; node(5); </dd></dl>

</div>
</div>
<a id="a6faf690077dab82f4d1f72920c3834fd" name="a6faf690077dab82f4d1f72920c3834fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6faf690077dab82f4d1f72920c3834fd">&#9670;&#160;</a></span>my_binary_tree() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;<a class="el" href="classmy__binary__tree.html">::my_binary_tree</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; &amp;</td>          <td class="paramname"><span class="paramname"><em>other</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>拷贝构造函数（深拷贝） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">other</td><td>待拷贝的二叉树对象 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>递归拷贝所有子节点，避免浅拷贝导致的内存问题；示例：my_binary_tree&lt;int&gt; a(b); </dd></dl>

</div>
</div>
<a id="aabd378c4f70ed8c8e76691769d111c59" name="aabd378c4f70ed8c8e76691769d111c59"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aabd378c4f70ed8c8e76691769d111c59">&#9670;&#160;</a></span>~my_binary_tree()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::~<a class="el" href="classmy__binary__tree.html">my_binary_tree</a> </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>析构函数（递归释放内存） </p>
<dl class="section note"><dt>Note</dt><dd>先释放左子树，再释放右子树，避免内存泄漏 </dd></dl>

</div>
</div>
<a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Member Function Documentation</h2>
<a id="aa23b0dbc0a4f4f7741111867f6d8b2e9" name="aa23b0dbc0a4f4f7741111867f6d8b2e9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa23b0dbc0a4f4f7741111867f6d8b2e9">&#9670;&#160;</a></span>append()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::append </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *</td>          <td class="paramname"><span class="paramname"><em>another_tree</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>l_or_r</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>向当前节点追加左/右子树 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">another_tree</td><td>待追加的子树指针 </td></tr>
    <tr><td class="paramname">l_or_r</td><td>追加位置："left"表示左子树，"right"表示右子树 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>若目标位置已有子树（非NULL），会触发断言失败（assert） </dd></dl>

</div>
</div>
<a id="a488bf2adcd7de91b9e259f6ef8c7762b" name="a488bf2adcd7de91b9e259f6ef8c7762b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a488bf2adcd7de91b9e259f6ef8c7762b">&#9670;&#160;</a></span>construct_binary_tree()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; * <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::construct_binary_tree </td>
          <td>(</td>
          <td class="paramtype">vector&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>values</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>index</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">T</td>          <td class="paramname"><span class="paramname"><em>space</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>层先法构造普通二叉树（支持空节点） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">values</td><td>存储节点数据的向量（按层序排列，空节点用space标记） </td></tr>
    <tr><td class="paramname">index</td><td>当前构造的节点在向量中的索引（初始为0） </td></tr>
    <tr><td class="paramname">space</td><td>空节点的标记值（通常使用全局常量space） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>构造完成的二叉树根节点指针（空节点返回NULL） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>向量中值为space的位置表示对应节点为空 </dd></dl>

</div>
</div>
<a id="a19f020b91ef749755745ac08d69be0b6" name="a19f020b91ef749755745ac08d69be0b6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a19f020b91ef749755745ac08d69be0b6">&#9670;&#160;</a></span>copy()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::copy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *</td>          <td class="paramname"><span class="paramname"><em>des</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *</td>          <td class="paramname"><span class="paramname"><em>src</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>复制二叉树（从src拷贝到des） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">des</td><td>目标二叉树指针（需提前创建） </td></tr>
    <tr><td class="paramname">src</td><td>源二叉树指针 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>拷贝data、left、right成员（浅拷贝，仅复制指针，不递归拷贝子树） </dd></dl>

</div>
</div>
<a id="a24a14198a85ebfd603f5284ef9940e41" name="a24a14198a85ebfd603f5284ef9940e41"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a24a14198a85ebfd603f5284ef9940e41">&#9670;&#160;</a></span>delete_point()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::delete_point </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *</td>          <td class="paramname"><span class="paramname"><em>point</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>删除节点（未实现） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">point</td><td>待删除的指针 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>函数体为空，需补充实现逻辑 </dd></dl>

</div>
</div>
<a id="a5fe4fbbeb0729ef67cc258d2a5350860" name="a5fe4fbbeb0729ef67cc258d2a5350860"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5fe4fbbeb0729ef67cc258d2a5350860">&#9670;&#160;</a></span>delete_pos()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::delete_pos </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>position</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>删除节点（未实现） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">position</td><td>删除位置标识（预留参数） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>函数体为空，需补充实现逻辑 </dd></dl>

</div>
</div>
<a id="a490bf7f8ebe87b6040b1294f73979fea" name="a490bf7f8ebe87b6040b1294f73979fea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a490bf7f8ebe87b6040b1294f73979fea">&#9670;&#160;</a></span>find()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; * <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::find </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>val</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>查找值为val的节点 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">val</td><td>待查找的值 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>找到的节点指针（未找到或树为空返回NULL） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>采用先序遍历查找（先查当前节点，再查左子树，最后查右子树） </dd></dl>

</div>
</div>
<a id="ad767eada19d83ada460c5eb0c2104056" name="ad767eada19d83ada460c5eb0c2104056"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad767eada19d83ada460c5eb0c2104056">&#9670;&#160;</a></span>find_father()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; * <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::find_father </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *</td>          <td class="paramname"><span class="paramname"><em>son</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>查找指定节点的父节点 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">son</td><td>待查找父节点的子节点指针 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>父节点指针（son为根节点或未找到时返回NULL） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>递归遍历树，若当前节点的左/右子树为son，则当前节点为父节点 </dd></dl>

</div>
</div>
<a id="ad8ae3e1b3073a79df62de135e337192a" name="ad8ae3e1b3073a79df62de135e337192a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad8ae3e1b3073a79df62de135e337192a">&#9670;&#160;</a></span>get_h_layer_nodes()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::get_h_layer_nodes </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>h</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>计算第h层的节点总数 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">h</td><td>目标层数（h &gt;= 1且h &lt;= 树高，否则触发断言失败） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>第h层的节点数量 </dd></dl>
<dl class="section note"><dt>Note</dt><dd>采用层序遍历（队列实现），逐层计数节点数量 </dd></dl>

</div>
</div>
<a id="a047c1a5b1fb76a0cb62700eb1c53bb8b" name="a047c1a5b1fb76a0cb62700eb1c53bb8b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a047c1a5b1fb76a0cb62700eb1c53bb8b">&#9670;&#160;</a></span>get_height()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::get_height </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>计算二叉树的高度 </p>
<dl class="section return"><dt>Returns</dt><dd>树的高度（根节点为第1层，空树返回0） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>递归计算：树高 = 1 + max(左子树高度, 右子树高度) </dd></dl>

</div>
</div>
<a id="a76f83530b098d7ad84262d21c885c15d" name="a76f83530b098d7ad84262d21c885c15d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a76f83530b098d7ad84262d21c885c15d">&#9670;&#160;</a></span>get_last_layer_nodes()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::get_last_layer_nodes </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>计算最后一层（叶子节点层）的节点总数 </p>
<dl class="section return"><dt>Returns</dt><dd>最后一层的节点数量 </dd></dl>
<dl class="section note"><dt>Note</dt><dd>本质是调用get_h_layer_nodes(get_height()) </dd></dl>

</div>
</div>
<a id="a9279b204f13b6f6e79646fe38387607a" name="a9279b204f13b6f6e79646fe38387607a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9279b204f13b6f6e79646fe38387607a">&#9670;&#160;</a></span>get_lrest_leave()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; * <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::get_lrest_leave </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>l_or_r</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>获取最左或最右的叶子节点 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">l_or_r</td><td>方向标识："left"表示最左叶子，"right"表示最右叶子 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>最左/右叶子节点的指针（若树为空，返回this） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>最左叶子：从根节点一直向左子树遍历，直到左子树为NULL；最右叶子类似 </dd></dl>

</div>
</div>
<a id="aabf0c965e92e633f4d25f9b88da19a28" name="aabf0c965e92e633f4d25f9b88da19a28"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aabf0c965e92e633f4d25f9b88da19a28">&#9670;&#160;</a></span>get_nodes_num()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::get_nodes_num </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>计算二叉树的总节点数 </p>
<dl class="section return"><dt>Returns</dt><dd>所有层的节点数量之和 </dd></dl>
<dl class="section note"><dt>Note</dt><dd>遍历所有层，累加每层节点数 </dd></dl>

</div>
</div>
<a id="a05b6069959ff87dc7824ce4e05db024a" name="a05b6069959ff87dc7824ce4e05db024a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a05b6069959ff87dc7824ce4e05db024a">&#9670;&#160;</a></span>get_value() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::get_value </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>打印当前节点的数据值 </p>
<dl class="section note"><dt>Note</dt><dd>直接输出data成员到标准输出流 </dd></dl>

</div>
</div>
<a id="ace03005196f04451f9af5c2ab663a990" name="ace03005196f04451f9af5c2ab663a990"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ace03005196f04451f9af5c2ab663a990">&#9670;&#160;</a></span>get_value() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::get_value </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>position</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>打印当前节点的数据值 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">position</td><td>二进制表示位置 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>直接输出data成员到标准输出流 </dd></dl>

</div>
</div>
<a id="a9675071237ce43751138c4fa3ef43657" name="a9675071237ce43751138c4fa3ef43657"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9675071237ce43751138c4fa3ef43657">&#9670;&#160;</a></span>insert()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::insert </td>
          <td>(</td>
          <td class="paramtype">T</td>          <td class="paramname"><span class="paramname"><em>val</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>position</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>插入节点（未实现） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">val</td><td>待插入的节点值 </td></tr>
    <tr><td class="paramname">position</td><td>插入位置标识（预留参数） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>函数体为空，需补充实现逻辑 </dd></dl>

</div>
</div>
<a id="a35c9081b6b3dfe457c8d29697ccfdfb1" name="a35c9081b6b3dfe457c8d29697ccfdfb1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a35c9081b6b3dfe457c8d29697ccfdfb1">&#9670;&#160;</a></span>is_balence_binary_tree()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::is_balence_binary_tree </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>判断二叉树是否为平衡二叉树（左右子树高度差不超过1） </p>
<dl class="section return"><dt>Returns</dt><dd>若是平衡树返回true，否则返回false </dd></dl>
<dl class="section note"><dt>Note</dt><dd>平衡树定义：任意节点的左右子树高度差 &lt;= 1；递归验证所有节点 </dd></dl>

</div>
</div>
<a id="adb685df412bb6481f5167165312868ad" name="adb685df412bb6481f5167165312868ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adb685df412bb6481f5167165312868ad">&#9670;&#160;</a></span>is_binary_search_tree()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::is_binary_search_tree </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>判断二叉树是否为二叉搜索树（BST） </p>
<dl class="section return"><dt>Returns</dt><dd>若是BST返回true，否则返回false </dd></dl>
<dl class="section note"><dt>Note</dt><dd>BST定义：左子树所有节点值 &lt;= 当前节点值 &lt;= 右子树所有节点值；递归验证左右子树 </dd></dl>

</div>
</div>
<a id="a8fc393aceaa7e46fc5fb6b9377c12ea3" name="a8fc393aceaa7e46fc5fb6b9377c12ea3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8fc393aceaa7e46fc5fb6b9377c12ea3">&#9670;&#160;</a></span>is_empty()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::is_empty </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>判断二叉树是否为空 </p>
<dl class="section return"><dt>Returns</dt><dd>若树为空（this == NULL），返回true；否则返回false </dd></dl>

</div>
</div>
<a id="a6f45e4cb6774b092b40bee77ee80b757" name="a6f45e4cb6774b092b40bee77ee80b757"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6f45e4cb6774b092b40bee77ee80b757">&#9670;&#160;</a></span>mirror()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::mirror </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>二叉树镜像（交换所有节点的左右子树） </p>
<dl class="section note"><dt>Note</dt><dd>递归交换当前节点的左右子树，再分别镜像左、右子树 </dd></dl>

</div>
</div>
<a id="aedeb2af1e014d361fb7c2f1423e9f58d" name="aedeb2af1e014d361fb7c2f1423e9f58d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aedeb2af1e014d361fb7c2f1423e9f58d">&#9670;&#160;</a></span>operator=()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; &amp; <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::operator= </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; &amp;</td>          <td class="paramname"><span class="paramname"><em>other</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>赋值运算符重载（深拷贝） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">other</td><td>待赋值的二叉树对象 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>当前对象的引用（*this） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>先释放当前对象的子树内存，再递归拷贝other的子树，避免内存泄漏 </dd></dl>

</div>
</div>
<a id="a52db051eb0ccae70e61baf638acd2f81" name="a52db051eb0ccae70e61baf638acd2f81"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a52db051eb0ccae70e61baf638acd2f81">&#9670;&#160;</a></span>operator[]()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">T <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::operator[] </td>
          <td>(</td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>index</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>索引运算符重载 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">index</td><td>待打印的索引号 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>index位置的值（不可更改） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>按层打印节点，空节点assert error </dd></dl>

</div>
</div>
<a id="aff9c3c138c4fc970016a826ec0653eaf" name="aff9c3c138c4fc970016a826ec0653eaf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aff9c3c138c4fc970016a826ec0653eaf">&#9670;&#160;</a></span>print_full_to_vector()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::print_full_to_vector </td>
          <td>(</td>
          <td class="paramtype">vector&lt; T &gt; &amp;</td>          <td class="paramname"><span class="paramname"><em>vv</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>层序遍历二叉树，将节点值存入向量（不含占位符） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">vv</td><td>存储结果的向量引用 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>调用traversal_binary_tree，配合print_fulltov函数实现 </dd></dl>

</div>
</div>
<a id="aa65e9e0bae93b835e20c32de429928d3" name="aa65e9e0bae93b835e20c32de429928d3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa65e9e0bae93b835e20c32de429928d3">&#9670;&#160;</a></span>print_to_vector()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::print_to_vector </td>
          <td>(</td>
          <td class="paramtype">vector&lt; T &gt; &amp;</td>          <td class="paramname"><span class="paramname"><em>vv</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>层序遍历二叉树，将节点值存入向量（空节点用占位符） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">vv</td><td>存储结果的向量引用（需提前分配空间，空节点用space标记） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>调用traversal_binary_tree，配合print_tov和empty_function实现 </dd></dl>

</div>
</div>
<a id="abf00c3450fd579d439c231202d2af556" name="abf00c3450fd579d439c231202d2af556"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abf00c3450fd579d439c231202d2af556">&#9670;&#160;</a></span>revolve() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; * <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::revolve </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; *</td>          <td class="paramname"><span class="paramname"><em>node</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>旋转二叉树（未实现） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node</td><td>不平衡的节点 </td></tr>
    <tr><td class="paramname">mode</td><td>旋转模式 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>函数体为空，需补充实现逻辑 </dd></dl>

</div>
</div>
<a id="a5842011f1564adb291d8a62f1f7e7625" name="a5842011f1564adb291d8a62f1f7e7625"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5842011f1564adb291d8a62f1f7e7625">&#9670;&#160;</a></span>revolve() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt; * <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::revolve </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>旋转二叉树（未实现） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode</td><td>旋转模式 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>旋转后的树 </dd></dl>
<dl class="section note"><dt>Note</dt><dd>函数体为空，需补充实现逻辑 </dd></dl>

</div>
</div>
<a id="a3b473ee42358d2ecda1958b1b72fd1dd" name="a3b473ee42358d2ecda1958b1b72fd1dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3b473ee42358d2ecda1958b1b72fd1dd">&#9670;&#160;</a></span>show_binary_tree()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::show_binary_tree </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>遍历二叉树并打印节点值 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode</td><td>遍历方式："first_root"（先序）、"mid_root"（中序）、"last_root"（后序）、"layer_first"（层序） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>不同遍历方式的节点访问顺序不同，结果直接输出到标准输出流 </dd></dl>

</div>
</div>
<a id="a4a4f092d8f75d1f8840db3c3b4b6f36e" name="a4a4f092d8f75d1f8840db3c3b4b6f36e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4a4f092d8f75d1f8840db3c3b4b6f36e">&#9670;&#160;</a></span>traversal_binary_tree() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<div class="memtemplate">
template&lt;typename Function&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">Function <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::traversal_binary_tree </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Function</td>          <td class="paramname"><span class="paramname"><em>F</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>遍历二叉树并执行自定义函数（无空节点处理） </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">Function</td><td>函数类型（需接收T类型参数，无返回值） </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode</td><td>遍历方式（同show_binary_tree） </td></tr>
    <tr><td class="paramname">F</td><td>待执行的函数（如print、self_increase等） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>传入的函数F（便于链式调用） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>遍历到的每个节点会作为参数传入F；空节点不做处理 </dd></dl>

</div>
</div>
<a id="ad3840bd8912df340bc10aa59bc89d1bd" name="ad3840bd8912df340bc10aa59bc89d1bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad3840bd8912df340bc10aa59bc89d1bd">&#9670;&#160;</a></span>traversal_binary_tree() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<div class="memtemplate">
template&lt;typename Function1, typename Function2&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">Function1 <a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;::traversal_binary_tree </td>
          <td>(</td>
          <td class="paramtype">string</td>          <td class="paramname"><span class="paramname"><em>mode</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Function1</td>          <td class="paramname"><span class="paramname"><em>F1</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Function2</td>          <td class="paramname"><span class="paramname"><em>F2</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>遍历二叉树并执行自定义函数（含空节点处理） </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">Function1</td><td>非空节点处理函数类型（接收T类型参数） </td></tr>
    <tr><td class="paramname">Function2</td><td>空节点处理函数类型（无参数） </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mode</td><td>遍历方式（同show_binary_tree） </td></tr>
    <tr><td class="paramname">F1</td><td>非空节点执行的函数 </td></tr>
    <tr><td class="paramname">F2</td><td>空节点执行的函数 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>传入的函数F1（便于链式调用） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>层序遍历时会显式处理空节点（调用F2），其他遍历方式仅在递归到空节点时调用F2 </dd></dl>

</div>
</div>
<a name="doc-related-members" id="doc-related-members"></a><h2 id="header-doc-related-members" class="groupheader">Friends And Related Symbol Documentation</h2>
<a id="a57bcf0e8e11dcb2db4d3c2b72e62d913" name="a57bcf0e8e11dcb2db4d3c2b72e62d913"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a57bcf0e8e11dcb2db4d3c2b72e62d913">&#9670;&#160;</a></span>operator!=</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool operator!= </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>lhs</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>rhs</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel friend">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>不等运算符重载 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">lhs</td><td>左操作数（二叉树对象） </td></tr>
    <tr><td class="paramname">rhs</td><td>右操作数（二叉树对象） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>若两棵树不相等，返回true；否则返回false </dd></dl>
<dl class="section note"><dt>Note</dt><dd>等价于!(lhs == rhs) </dd></dl>

</div>
</div>
<a id="a9b9d88b02caf22fc6de3a78e3a514816" name="a9b9d88b02caf22fc6de3a78e3a514816"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b9d88b02caf22fc6de3a78e3a514816">&#9670;&#160;</a></span>operator&lt;&lt;</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">ostream &amp; operator&lt;&lt; </td>
          <td>(</td>
          <td class="paramtype">ostream &amp;</td>          <td class="paramname"><span class="paramname"><em>os</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>p</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel friend">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>输出运算符重载（格式化打印二叉树） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">os</td><td>输出流对象 </td></tr>
    <tr><td class="paramname">p</td><td>待打印的二叉树对象 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>输出流对象（便于链式输出） </dd></dl>
<dl class="section note"><dt>Note</dt><dd>按层打印节点，空节点用'*'表示，节点间用空格分隔，模拟树形结构 </dd></dl>

</div>
</div>
<a id="a9b5581a82079878a7faac62d07bbcc12" name="a9b5581a82079878a7faac62d07bbcc12"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b5581a82079878a7faac62d07bbcc12">&#9670;&#160;</a></span>operator==</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool operator== </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>lhs</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classmy__binary__tree.html">my_binary_tree</a>&lt; T &gt;</td>          <td class="paramname"><span class="paramname"><em>rhs</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel friend">friend</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>相等运算符重载（判断两棵树是否完全相同） </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">lhs</td><td>左操作数（二叉树对象） </td></tr>
    <tr><td class="paramname">rhs</td><td>右操作数（二叉树对象） </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>若结构和节点值完全相同，返回true；否则返回false </dd></dl>
<dl class="section note"><dt>Note</dt><dd>递归判断：当前节点值相等 + 左子树相等 + 右子树相等 </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="my__binary__tree_8h_source.html">my_binary_tree.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a href="classmy__binary__tree.html">my_binary_tree</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0 </li>
  </ul>
</div>
</body>
</html>
